<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta property="og:title" content="Node.js使用sequelize ORM框架" />
<meta property="og:description" content="使用Node.js连接数据库的话到时候更新，先更新sequelize这个框架，轻量级很舒服！
当然ThinkORM挺舒服的，缺点就是挺重量级适合企业级项目 &#43;_&#43;。
Sequelize 是一个基于 promise 的 Node.js ORM, 目前支持 Postgres, MySQL, MariaDB, SQLite 以及 Microsoft SQL Server. 它具有强大的事务支持, 关联关系, 预读和延迟加载,读取复制等功能。
安装 1 2 3 4 # 使用 npm npm i sequelize # 这将安装最新版本的 Sequelize # 使用 yarn yarn add sequelize 配置 config.js
1 2 3 4 5 6 7 8 9 10 module.exports = { DB : { host : &#39;127.0.0.1&#39;, // 服务器地址 port : 3306, // 数据库端口号 username: &#39;root&#39;, // 数据库用户名 password: &#39;wuju&#39;, // 数据库密码 database: &#39;test&#39;, // 数据库名称 prefix: &#39;&#39; // 数据库前缀 } } db/connect." />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://wuju-i.gitee.io/post/20210618/" /><meta property="article:section" content="post" />
<meta property="article:published_time" content="2021-06-18T00:00:00+00:00" />
<meta property="article:modified_time" content="2021-06-18T00:00:00+00:00" />

  <meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Node.js使用sequelize ORM框架"/>
<meta name="twitter:description" content="使用Node.js连接数据库的话到时候更新，先更新sequelize这个框架，轻量级很舒服！
当然ThinkORM挺舒服的，缺点就是挺重量级适合企业级项目 &#43;_&#43;。
Sequelize 是一个基于 promise 的 Node.js ORM, 目前支持 Postgres, MySQL, MariaDB, SQLite 以及 Microsoft SQL Server. 它具有强大的事务支持, 关联关系, 预读和延迟加载,读取复制等功能。
安装 1 2 3 4 # 使用 npm npm i sequelize # 这将安装最新版本的 Sequelize # 使用 yarn yarn add sequelize 配置 config.js
1 2 3 4 5 6 7 8 9 10 module.exports = { DB : { host : &#39;127.0.0.1&#39;, // 服务器地址 port : 3306, // 数据库端口号 username: &#39;root&#39;, // 数据库用户名 password: &#39;wuju&#39;, // 数据库密码 database: &#39;test&#39;, // 数据库名称 prefix: &#39;&#39; // 数据库前缀 } } db/connect."/>

  
  <meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff">
  <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#262d33">
  <title>
    
    橘子的博客 - Node.js使用sequelize ORM框架
    
  </title>
  
  <link rel="shortcut icon" href="g.png" type="image/x-icon" />
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&display=swap"
    rel="stylesheet">
  
  
  
  <link rel="stylesheet" href="/minima.1714031344.css">

  
  
  <script defer type="text/javascript" src="/minima.1714031344.js"></script>
</head>
<script>
  
  let theme_2b_used = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';

  try {
    if (!('theme' in localStorage)) {
      const default_theme = '';
      
      
      if (default_theme === 'dark' || default_theme === 'light') {
        theme_2b_used = default_theme;
      }

      
      localStorage.theme = theme_2b_used;
    }
    
    document.querySelector('html').classList.add(localStorage.theme);
  } catch (e) {
    console.error(e);
  }
</script>


<body class=" sm:mx-5 sm:my-0">
  <header class="flex justify-between items-center mb-6 sm:my-3">
  <div class="flex items-center">
    
    <div id="theme-switcher" class="text-4xl cursor-pointer">🌑</div>
  </div>
  <nav class="flex items-center
    whitespace-nowrap overflow-x-auto overflow-y-hidden">
    
    <a class="ml-5" href="/">首页</a>
    
    <a class="ml-5" href="/categories">分类</a>
    
    <a class="ml-5" href="/log">日记</a>
    
    <a class="ml-5" href="/about">关于</a>
    
  </nav>
</header>
  
  

<h1 class="mt-6 mb-6">Node.js使用sequelize ORM框架</h1>
<div class="mb-3 text-xs flex justify-between sm:flex-col">
	<div>
	
		Posted at &mdash; 21年 6月18日
	
		
	</div>
	
</div>
<main>
	<p></p>
	<article class="md">
		<p>使用Node.js连接数据库的话到时候更新，先更新sequelize这个框架，轻量级很舒服！<br>
当然ThinkORM挺舒服的，缺点就是挺重量级适合企业级项目 +_+。</p>
<p>Sequelize 是一个基于 promise 的 Node.js ORM, 目前支持 Postgres, MySQL, MariaDB, SQLite 以及 Microsoft SQL Server. 它具有强大的事务支持, 关联关系, 预读和延迟加载,读取复制等功能。</p>
<h2 id="安装">安装</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># 使用 npm</span>
</span></span><span class="line"><span class="cl">npm i sequelize <span class="c1"># 这将安装最新版本的 Sequelize</span>
</span></span><span class="line"><span class="cl"><span class="c1"># 使用 yarn</span>
</span></span><span class="line"><span class="cl">yarn add sequelize
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="配置">配置</h2>
<p>config.js</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span> <span class="o">=</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">	<span class="nx">DB</span> <span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">		<span class="nx">host</span> <span class="o">:</span> <span class="s1">&#39;127.0.0.1&#39;</span><span class="p">,</span> <span class="c1">// 服务器地址
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>		<span class="nx">port</span> <span class="o">:</span> <span class="mi">3306</span><span class="p">,</span> <span class="c1">// 数据库端口号
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>		<span class="nx">username</span><span class="o">:</span> <span class="s1">&#39;root&#39;</span><span class="p">,</span> <span class="c1">// 数据库用户名
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>		<span class="nx">password</span><span class="o">:</span> <span class="s1">&#39;wuju&#39;</span><span class="p">,</span> <span class="c1">// 数据库密码
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>		<span class="nx">database</span><span class="o">:</span> <span class="s1">&#39;test&#39;</span><span class="p">,</span> <span class="c1">// 数据库名称
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>		<span class="nx">prefix</span><span class="o">:</span> <span class="s1">&#39;&#39;</span> <span class="c1">// 数据库前缀
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>	<span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>db/connect.js</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">const</span> <span class="p">{</span> <span class="nx">Sequelize</span> <span class="p">}</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;sequelize&#39;</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;../../config&#39;</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">var</span> <span class="nx">sequelize</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="c1">// 测试连接
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">	<span class="nx">sequelize</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Sequelize</span><span class="p">(</span><span class="nx">config</span><span class="p">[</span><span class="s1">&#39;DB&#39;</span><span class="p">].</span><span class="nx">database</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">	<span class="nx">config</span><span class="p">[</span><span class="s1">&#39;DB&#39;</span><span class="p">].</span><span class="nx">username</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">	<span class="nx">config</span><span class="p">[</span><span class="s1">&#39;DB&#39;</span><span class="p">].</span><span class="nx">password</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">		<span class="nx">host</span><span class="o">:</span> <span class="nx">config</span><span class="p">[</span><span class="s1">&#39;DB&#39;</span><span class="p">].</span><span class="nx">host</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">		<span class="nx">dialect</span><span class="o">:</span> <span class="s1">&#39;mysql&#39;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">		<span class="c1">// logging: false, // 取消日志
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>	<span class="p">});</span>
</span></span><span class="line"><span class="cl">	<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;数据库连接成功&#39;</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">	<span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s1">&#39;数据库连接失败，异常信息:&#39;</span><span class="p">,</span> <span class="nx">error</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span> <span class="o">=</span> <span class="nx">sequelize</span><span class="p">;</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>编写model</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span><span class="lnt">22
</span><span class="lnt">23
</span><span class="lnt">24
</span><span class="lnt">25
</span><span class="lnt">26
</span><span class="lnt">27
</span><span class="lnt">28
</span><span class="lnt">29
</span><span class="lnt">30
</span><span class="lnt">31
</span><span class="lnt">32
</span><span class="lnt">33
</span><span class="lnt">34
</span><span class="lnt">35
</span><span class="lnt">36
</span><span class="lnt">37
</span><span class="lnt">38
</span><span class="lnt">39
</span><span class="lnt">40
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">const</span> <span class="p">{</span> <span class="nx">DataTypes</span> <span class="p">}</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;sequelize&#39;</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">sequelize</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;../../db/connect&#39;</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">User</span> <span class="o">=</span> <span class="nx">sequelize</span><span class="p">.</span><span class="nx">define</span><span class="p">(</span><span class="s1">&#39;u&#39;</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">	<span class="nx">id</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">		<span class="nx">type</span><span class="o">:</span> <span class="nx">DataTypes</span><span class="p">.</span><span class="nx">INTEGER</span><span class="p">,</span> <span class="c1">// 类型
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>		<span class="nx">primaryKey</span><span class="o">:</span> <span class="kc">true</span> <span class="c1">// 键
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>	<span class="p">},</span>
</span></span><span class="line"><span class="cl">	<span class="nx">username</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">		<span class="nx">type</span><span class="o">:</span> <span class="nx">DataTypes</span><span class="p">.</span><span class="nx">STRING</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">		<span class="nx">field</span><span class="o">:</span> <span class="s1">&#39;username&#39;</span>
</span></span><span class="line"><span class="cl">	<span class="p">},</span>
</span></span><span class="line"><span class="cl">	<span class="nx">password</span> <span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">		<span class="nx">type</span><span class="o">:</span> <span class="nx">DataTypes</span><span class="p">.</span><span class="nx">STRING</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">		<span class="nx">field</span><span class="o">:</span> <span class="s1">&#39;password&#39;</span>
</span></span><span class="line"><span class="cl">	<span class="p">},</span>
</span></span><span class="line"><span class="cl">	<span class="nx">email</span> <span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">		<span class="nx">type</span><span class="o">:</span> <span class="nx">DataTypes</span><span class="p">.</span><span class="nx">STRING</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">		<span class="nx">field</span><span class="o">:</span> <span class="s1">&#39;email&#39;</span>
</span></span><span class="line"><span class="cl">	<span class="p">},</span>
</span></span><span class="line"><span class="cl">	<span class="nx">nickname</span> <span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">		<span class="nx">type</span><span class="o">:</span> <span class="nx">DataTypes</span><span class="p">.</span><span class="nx">STRING</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">		<span class="nx">field</span><span class="o">:</span> <span class="s1">&#39;nickname&#39;</span>
</span></span><span class="line"><span class="cl">	<span class="p">},</span>
</span></span><span class="line"><span class="cl">	<span class="nx">token</span> <span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">		<span class="nx">type</span><span class="o">:</span> <span class="nx">DataTypes</span><span class="p">.</span><span class="nx">STRING</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">		<span class="nx">field</span><span class="o">:</span> <span class="s1">&#39;token&#39;</span>
</span></span><span class="line"><span class="cl">	<span class="p">},</span>
</span></span><span class="line"><span class="cl">	<span class="nx">cTime</span> <span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">		<span class="nx">type</span><span class="o">:</span> <span class="nx">DataTypes</span><span class="p">.</span><span class="nx">INTEGER</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">		<span class="nx">field</span><span class="o">:</span> <span class="s1">&#39;token&#39;</span>
</span></span><span class="line"><span class="cl">	<span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">},{</span>
</span></span><span class="line"><span class="cl">	<span class="c1">// 表名
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>	<span class="nx">tableName</span><span class="o">:</span> <span class="s1">&#39;i_users&#39;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">	<span class="nx">timestamps</span><span class="o">:</span> <span class="kc">false</span> <span class="c1">// 不添加时间字段
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="p">});</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span> <span class="o">=</span> <span class="nx">User</span><span class="p">;</span>
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="使用">使用</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span><span class="lnt">22
</span><span class="lnt">23
</span><span class="lnt">24
</span><span class="lnt">25
</span><span class="lnt">26
</span><span class="lnt">27
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">models</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;../app/user/models&#39;</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">class</span> <span class="nx">User</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">	<span class="kr">static</span> <span class="kr">async</span> <span class="nx">find</span><span class="p">(</span><span class="nx">query</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">		<span class="kd">let</span> <span class="nx">ret</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">models</span><span class="p">.</span><span class="nx">findOne</span><span class="p">({</span>
</span></span><span class="line"><span class="cl">			<span class="nx">where</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">				<span class="p">...</span><span class="nx">query</span>
</span></span><span class="line"><span class="cl">			<span class="p">}</span>
</span></span><span class="line"><span class="cl">		<span class="p">});</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">		<span class="k">return</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">ret</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">	<span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">	<span class="kr">static</span> <span class="kr">async</span> <span class="nx">add</span><span class="p">(</span><span class="nx">query</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">		<span class="k">return</span> <span class="kr">await</span> <span class="nx">models</span><span class="p">.</span><span class="nx">create</span><span class="p">({</span>
</span></span><span class="line"><span class="cl">			<span class="nx">username</span> <span class="o">:</span> <span class="nx">query</span><span class="p">.</span><span class="nx">username</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">			<span class="nx">password</span> <span class="o">:</span> <span class="nx">query</span><span class="p">.</span><span class="nx">password</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">			<span class="nx">nickname</span> <span class="o">:</span> <span class="nx">query</span><span class="p">.</span><span class="nx">nickname</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">			<span class="nx">token</span> <span class="o">:</span> <span class="s1">&#39;AAAAAAAAAAAAAA&#39;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">			<span class="nx">cTime</span> <span class="o">:</span> <span class="nb">Date</span><span class="p">.</span><span class="nx">now</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">		<span class="p">})</span>
</span></span><span class="line"><span class="cl">	<span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span> <span class="o">=</span> <span class="nx">User</span><span class="p">;</span>
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="末尾">末尾</h2>
<ul>
<li>sequelize 在线文档：<a href="https://www.sequelize.com.cn/">阅读</a></li>
</ul>

	</article>
</main>





	

	

	



  <footer class="mt-8 flex sm:flex-col-reverse justify-between items-center">
  <p class="mt-0 text-sm">
    © 2022 | 橘子
    
  </p>
  <p class="flex items-center mt-0">
    
  </p>
</footer>
</body>
</html>